package cn.iocoder.yudao.module.erp.dal.mysql.stock.bom;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.bom.vo.BomPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.bom.BomDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * BOM Mapper
 *
 * @author maxuxu
 */
@Mapper
public interface BomMapper extends BaseMapperX<BomDO> {

    default PageResult<BomDO> selectPage(BomPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BomDO>()
                .likeIfPresent(BomDO::getCode, reqVO.getCode())
                .eqIfPresent(BomDO::getVersion, reqVO.getVersion())
                .eqIfPresent(BomDO::getDefaultFlag, reqVO.getDefaultFlag())
                .likeIfPresent(BomDO::getProdName, reqVO.getProdName())
                .likeIfPresent(BomDO::getAccessoryList, reqVO.getAccessoryList())
                .betweenIfPresent(BomDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BomDO::getProdNo, reqVO.getProdNo())
                .orderByDesc(BomDO::getId));
    }

}